/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.googlecode.botdispatch;


public interface AsyncCallback<T> {

    /**
     * Called when an asynchronous call fails to complete normally.
     * {@link IncompatibleRemoteServiceException}s, {@link InvocationException}s,
     * or checked exceptions thrown by the service method are examples of the type
     * of failures that can be passed to this method.
     * <p/>
     * <p>
     * If <code>caught</code> is an instance of an
     * {@link IncompatibleRemoteServiceException} the application should try to
     * get into a state where a browser refresh can be safely done.
     * </p>
     *
     * @param caught failure encountered while executing a remote procedure call
     */
    void onFailure(Throwable caught);

    /**
     * Called when an asynchronous call completes successfully.
     *
     * @param result the return value of the remote produced call
     */
    void onSuccess(T result);
}
